<? 
	session_start();
	require("connect.php");	
	$mahs=$_POST["mahs"];	
	$hotendem=$_POST["hotendem"];
	$ten=$_POST["ten"];
	$anh=$_POST["anh"];
	$gioitinh=$_POST["gioitinh"];	
	$ngay=$_POST["demol1"];	
	$ngaythang=split("-",$ngay);	
	$ngaykt=$ngaythang[0];
	$thangkt=$ngaythang[1];
	$namkt=$ngaythang[2];	
	$ngaysinh=$namkt."-".$thangkt."-".$ngaykt;
	$diachi=$_POST["diachi"];	
	$mal=$_REQUEST["mal"];
	$username=$mahs;
	$password=md5($mahs);		
	$sql="insert into hocsinh(mahs,hotendem,ten,anh,gioitinh,ngaysinh,diachi,mal) values('{$mahs}','{$hotendem}','{$ten}','{$anh}','{$gioitinh}','{$ngaysinh}','{$diachi}','{$mal}')";
	$sql2="insert into nguoidung(username,password,quyen) values('{$username}','{$password}','3')";	
	mysql_query("$sql") or die("Error!");
	mysql_query("$sql2") or die("Error!");
	mysql_close();
	header("Location:hocsinh_admin_detail.php?mahs={$mahs}");
	
?>